package cn.gson.springboot.model.pojos;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Objects;

@Entity
@Table(name = "deliveryrecord_", schema = "crm")
public class Deliveryrecord {
    private int deliveryrecordId;
    private String deliveryrecordReceiver;
    private String deliveryrecordName;
    private Integer deliveryrecordCount;
    private String deliveryrecordUnit;
    private String deliveryrecordModel;
    private BigDecimal deliveryrecordPrice;
    private BigDecimal deliveryrecordMoney;
    private String deliveryrecordNote;
    private Invoice invoiceByInvoiceId;
    private Contract contractByContractId;
    private Employee employeeByEmpId;
    private Customer customerByCustomerId;
    @Id
    @Column(name = "deliveryrecord_id", nullable = false)
    public int getDeliveryrecordId() {
        return deliveryrecordId;
    }

    public void setDeliveryrecordId(int deliveryrecordId) {
        this.deliveryrecordId = deliveryrecordId;
    }


    @Basic
    @Column(name = "deliveryrecord_receiver", nullable = true, length = 255)
    public String getDeliveryrecordReceiver() {
        return deliveryrecordReceiver;
    }

    public void setDeliveryrecordReceiver(String deliveryrecordReceiver) {
        this.deliveryrecordReceiver = deliveryrecordReceiver;
    }

    @Basic
    @Column(name = "deliveryrecord_name", nullable = true, length = 255)
    public String getDeliveryrecordName() {
        return deliveryrecordName;
    }

    public void setDeliveryrecordName(String deliveryrecordName) {
        this.deliveryrecordName = deliveryrecordName;
    }

    @Basic
    @Column(name = "deliveryrecord_count", nullable = true)
    public Integer getDeliveryrecordCount() {
        return deliveryrecordCount;
    }

    public void setDeliveryrecordCount(Integer deliveryrecordCount) {
        this.deliveryrecordCount = deliveryrecordCount;
    }

    @Basic
    @Column(name = "deliveryrecord_unit", nullable = true, length = 255)
    public String getDeliveryrecordUnit() {
        return deliveryrecordUnit;
    }

    public void setDeliveryrecordUnit(String deliveryrecordUnit) {
        this.deliveryrecordUnit = deliveryrecordUnit;
    }

    @Basic
    @Column(name = "deliveryrecord_model", nullable = true, length = 255)
    public String getDeliveryrecordModel() {
        return deliveryrecordModel;
    }

    public void setDeliveryrecordModel(String deliveryrecordModel) {
        this.deliveryrecordModel = deliveryrecordModel;
    }

    @Basic
    @Column(name = "deliveryrecord_price", nullable = true, precision = 2)
    public BigDecimal getDeliveryrecordPrice() {
        return deliveryrecordPrice;
    }

    public void setDeliveryrecordPrice(BigDecimal deliveryrecordPrice) {
        this.deliveryrecordPrice = deliveryrecordPrice;
    }

    @Basic
    @Column(name = "deliveryrecord_money", nullable = true, precision = 2)
    public BigDecimal getDeliveryrecordMoney() {
        return deliveryrecordMoney;
    }

    public void setDeliveryrecordMoney(BigDecimal deliveryrecordMoney) {
        this.deliveryrecordMoney = deliveryrecordMoney;
    }

    @Basic
    @Column(name = "deliveryrecord_note", nullable = true, length = 255)
    public String getDeliveryrecordNote() {
        return deliveryrecordNote;
    }

    public void setDeliveryrecordNote(String deliveryrecordNote) {
        this.deliveryrecordNote = deliveryrecordNote;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Deliveryrecord that = (Deliveryrecord) o;
        return deliveryrecordId == that.deliveryrecordId &&
                Objects.equals(deliveryrecordReceiver, that.deliveryrecordReceiver) &&
                Objects.equals(deliveryrecordName, that.deliveryrecordName) &&
                Objects.equals(deliveryrecordCount, that.deliveryrecordCount) &&
                Objects.equals(deliveryrecordUnit, that.deliveryrecordUnit) &&
                Objects.equals(deliveryrecordModel, that.deliveryrecordModel) &&
                Objects.equals(deliveryrecordPrice, that.deliveryrecordPrice) &&
                Objects.equals(deliveryrecordMoney, that.deliveryrecordMoney) &&
                Objects.equals(deliveryrecordNote, that.deliveryrecordNote);
    }

    @Override
    public int hashCode() {
        return Objects.hash(deliveryrecordId, deliveryrecordReceiver, deliveryrecordName, deliveryrecordCount, deliveryrecordUnit, deliveryrecordModel, deliveryrecordPrice, deliveryrecordMoney, deliveryrecordNote);
    }

    @ManyToOne
    @JoinColumn(name = "emp_id", referencedColumnName = "emp_id")
    public Employee getEmployeeByEmpId() {
        return employeeByEmpId;
    }

    public void setEmployeeByEmpId(Employee employeeByEmpId) {
        this.employeeByEmpId = employeeByEmpId;
    }

    @ManyToOne
    @JoinColumn(name = "customer_id", referencedColumnName = "customer_id")
    public Customer getCustomerByCustomerId() {
        return customerByCustomerId;
    }

    public void setCustomerByCustomerId(Customer customerByCustomerId) {
        this.customerByCustomerId = customerByCustomerId;
    }

    @ManyToOne
    @JoinColumn(name = "contract_id", referencedColumnName = "contract_id")
    public Contract getContractByContractId() {
        return contractByContractId;
    }

    public void setContractByContractId(Contract contractByContractId) {
        this.contractByContractId = contractByContractId;
    }

    @ManyToOne
    @JoinColumn(name = "invoice_id", referencedColumnName = "invoice_id")
    public Invoice getInvoiceByInvoiceId() {
        return invoiceByInvoiceId;
    }

    public void setInvoiceByInvoiceId(Invoice invoiceByInvoiceId) {
        this.invoiceByInvoiceId = invoiceByInvoiceId;
    }
}
